﻿using MediatR;
using RBAC.LuFang.API.Application.Command.RoleCommand;
using RBAC.LuFang.Domain;
using RBAC.LuFang.Domin.Services;

namespace RBAC.LuFang.API.Application.CommandHandlers.RoleHandler
{
    //修改
    public class RoleUpdateCommandHandler:IRequestHandler<RoleUpdateCommand,int>
    {
        private readonly IRoleService _roleService;

        public RoleUpdateCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }

        public async Task<int> Handle(RoleUpdateCommand request, CancellationToken cancellationToken)
        {
            var roleModel=new Role() { RoleId=request.RoleId,RoleName = request.RoleName,addName=request.addName,addDate=request.addDate};
            return await _roleService.UpdRole(roleModel);
        }
    }
}
